package com.qf.springmvc.controller;

import com.qf.springmvc.entity.User;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Date;


@Controller
@RequestMapping("/hello")
public class HelloController {

    @RequestMapping("/test1")
    public String test1(@RequestParam(value = "name",required = false) String username, Integer age, @DateTimeFormat(pattern = "yyyy-MM-dd") Date birthday){
        System.out.println("Hello SpringMVC");

        System.out.println("name=" + username + ",age=" + age+"birthday="+birthday);
        return "index";
    }


    @RequestMapping("/test2")
    public String test2(User user){
        System.out.println("Hello SpringMVC Test2");
        System.out.println(user);
        return "welcome";
    }

}
